$(function () {
    share();
    var myFakeLoading=new FakerLoading('.loadingBox',{
        bgColor:'rgba(0,0,0,.6)',
        childrenScale:1.5
    });
    $('#submit').click(function(){
        var oldPwd=$('input[name=oldPwd]').val();
        var newPwd=$('input[name=newPwd]').val();
        var surePwd=$('input[name=surePwd]').val();
        if(newPwd===surePwd){
            myFakeLoading.showIn();
            $.ajax({
                url:host+'CMSAPI/updateChannelPwd?openid='+openid+'&cid='+cid+'&pwd='+newPwd+'&oldpwd='+oldPwd,
                success:function(data){
                    if(data.state){
                        alert('修改密码成功！');
                        myFakeLoading.showOut();
                        history.go(-1);
                    }else {
                        if(data.message==='原密码不对！'){
                            $('.tip').html('原密码不正确！').show();
                        }else {
                            alert(data.message);
                        }
                    }
                }
            })
        }else {
            $('.tip').html('两次密码输入不一样!').show();
        }
    })
})